using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;
using Engine;
namespace WindowsGame1
{
    /// <summary>
    /// This is the main type for your game
    /// </summary>
    public class Game1 : Microsoft.Xna.Framework.Game
    {
        GraphicsDeviceManager graphics;
        SpriteBatch spriteBatch;
        
        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            graphics.PreferredBackBufferWidth = 800;
            graphics.PreferredBackBufferHeight = 600; //Resolucion de pantalla 
            Content.RootDirectory = "Content";
        }

        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            Lineax.Initialize(graphics);
            base.Initialize();
            // TODO: Add your initialization logic here
           
            /*
            pixel = new Texture2D(graphics.GraphicsDevice, 1, 1);//Esto me hace un pixel :D
            Color[] col = new Color[1];
            col[0] = Color.White;
            pixel.SetData<Color>(col);
           */
        }

        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
           
            //actors.Add(new Actor3D(Content.Load<Model>("Iron Man"), new Vector3(0, -100, 200), new Vector3(1, 1, 1), 160.0f));
            //actors.Add(new Actor3D(Content.Load<Model>("Iron Man"), new Vector3(300, -100, 200), new Vector3(1, 1, 1), 160.0f));
            
            SceneManager.scenes.Add(new menuScene(Content));
            // TODO: use this.Content to load your game content here

        }

        /// <summary>
        /// UnloadContent will be called once per game and is the place to unload
        /// all content.
        /// </summary>
        protected override void UnloadContent()
        {
            // TODO: Unload any non ContentManager content here
        }

        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            // Allows the game to exit
            SceneManager.update(gameTime.ElapsedGameTime.Milliseconds);

           // UpdateInput();
            base.Update(gameTime);
        }

        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);
            spriteBatch.Begin();

            SceneManager.draw(spriteBatch);

            spriteBatch.End();

            // TODO: Add your drawing code here

            base.Draw(gameTime);
        }

       /* void drawLine(SpriteBatch sb, Vector2 start, Vector2 end)
        {
            float rot = (float)Math.Atan2(end.Y - start.Y, end.X - start.X);
            Vector2 pos = start;
            float xScale = (float)Math.Sqrt((end.X-start.X)*(end.X-start.X)+(end.Y-start.Y)*(end.Y-start.Y));
            Rectangle jaja = new Rectangle(0,0,1,1);
            
            sb.Draw(pixel, pos, jaja, Color.Wheat, rot, pos, new Vector2(xScale,5), SpriteEffects.None, 0);
        }

        void drawRect(SpriteBatch sb, Vector2 rectX, Vector2 rectY, Vector2 rectH, Vector2 rectW)
        { 
            
        }*/

        
    }
}